home *** CD-ROM | disk | FTP | other *** search
/ C++ für Kids / C++ for kids.iso / SETUP / US / CBUILDER / DATA.Z / SHELLAPI.PAS < prev    next >
Pascal/Delphi Source File  |  1997-02-13  |  20KB  |  501 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Delphi Runtime Library                          }
  5. {       Windows 32bit API Interface Unit                }
  6. {                                                       }
  7. {       Copyright (c) 1992,96 Borland International     }
  8. {                                                       }
  9. {*******************************************************}
  10.  
  11. unit ShellAPI;
  12.  
  13. interface
  14.  
  15. uses Windows;
  16.  
  17. type
  18.   HDROP = Longint;
  19.   {$nonamespace HDROP}
  20.   PPWideChar = ^PWideChar;
  21.  
  22. function DragQueryFileA(Drop: HDROP; FileIndex: UINT; FileName: PAnsiChar; cb: UINT): UINT; stdcall;
  23. function DragQueryFileW(Drop: HDROP; FileIndex: UINT; FileName: PWideChar; cb: UINT): UINT; stdcall;
  24. function DragQueryFile(Drop: HDROP; FileIndex: UINT; FileName: PChar; cb: UINT): UINT; stdcall;
  25. function DragQueryPoint(Drop: HDROP; var Point: TPoint): BOOL; stdcall;
  26. procedure DragFinish(Drop: HDROP); stdcall;
  27. procedure DragAcceptFiles(Wnd: HWND; Accept: BOOL); stdcall;
  28. function ShellExecuteA(hWnd: HWND; Operation, FileName, Parameters,
  29.   Directory: PAnsiChar; ShowCmd: Integer): HINST; stdcall;
  30. function ShellExecuteW(hWnd: HWND; Operation, FileName, Parameters,
  31.   Directory: PWideChar; ShowCmd: Integer): HINST; stdcall;
  32. function ShellExecute(hWnd: HWND; Operation, FileName, Parameters,
  33.   Directory: PChar; ShowCmd: Integer): HINST; stdcall;
  34. function FindExecutableA(FileName, Directory: PAnsiChar; Result: PAnsiChar): HINST; stdcall;
  35. function FindExecutableW(FileName, Directory: PWideChar; Result: PWideChar): HINST; stdcall;
  36. function FindExecutable(FileName, Directory: PChar; Result: PChar): HINST; stdcall;
  37. function CommandLineToArgvW(lpCmdLine: LPCWSTR; var pNumArgs: Integer): PPWideChar; stdcall;
  38. function ShellAboutA(Wnd: HWND; szApp, szOtherStuff: PAnsiChar; Icon: HICON): Integer; stdcall;
  39. function ShellAboutW(Wnd: HWND; szApp, szOtherStuff: PWideChar; Icon: HICON): Integer; stdcall;
  40. function ShellAbout(Wnd: HWND; szApp, szOtherStuff: PChar; Icon: HICON): Integer; stdcall;
  41. function DuplicateIcon(hInst: HINST; Icon: HICON): HICON; stdcall;
  42. function ExtractAssociatedIconA(hInst: HINST; lpIconPath: PAnsiChar;
  43.   var lpiIcon: Word): HICON; stdcall;
  44. function ExtractAssociatedIconW(hInst: HINST; lpIconPath: PWideChar;
  45.   var lpiIcon: Word): HICON; stdcall;
  46. function ExtractAssociatedIcon(hInst: HINST; lpIconPath: PChar;
  47.   var lpiIcon: Word): HICON; stdcall;
  48. function ExtractIconA(hInst: HINST; lpszExeFileName: PAnsiChar;
  49.   nIconIndex: UINT): HICON; stdcall;
  50. function ExtractIconW(hInst: HINST; lpszExeFileName: PWideChar;
  51.   nIconIndex: UINT): HICON; stdcall;
  52. function ExtractIcon(hInst: HINST; lpszExeFileName: PChar;
  53.   nIconIndex: UINT): HICON; stdcall;
  54.  
  55. type
  56.   PDragInfoA = ^TDragInfoA;
  57.   PDragInfoW = ^TDragInfoW;
  58.   PDragInfo = PDragInfoA;
  59.   TDragInfoA = record
  60.     uSize: UINT;                 { init with SizeOf(DRAGINFO) }
  61.     pt: TPoint;
  62.     fNC: BOOL;
  63.     lpFileList: PAnsiChar;
  64.     grfKeyState: DWORD;
  65.   end;
  66.   TDragInfoW = record
  67.     uSize: UINT;                 { init with SizeOf(DRAGINFO) }
  68.     pt: TPoint;
  69.     fNC: BOOL;
  70.     lpFileList: PWideChar;
  71.     grfKeyState: DWORD;
  72.   end;
  73.   TDragInfo = TDragInfoA;
  74.  
  75. const
  76. { AppBar stuff }
  77.  
  78.   ABM_NEW           = $00000000;
  79.   ABM_REMOVE        = $00000001;
  80.   ABM_QUERYPOS      = $00000002;
  81.   ABM_SETPOS        = $00000003;
  82.   ABM_GETSTATE      = $00000004;
  83.   ABM_GETTASKBARPOS = $00000005;
  84.   ABM_ACTIVATE      = $00000006;  { lParam = True/False means activate/deactivate }
  85.   ABM_GETAUTOHIDEBAR = $00000007;
  86.   ABM_SETAUTOHIDEBAR = $00000008;  { this can fail at any time.  MUST check the result
  87.                                      lParam = TRUE/FALSE  Set/Unset
  88.                                      uEdge = what edge }
  89.   ABM_WINDOWPOSCHANGED = $0000009;
  90.  
  91. { these are put in the wparam of callback messages }
  92.  
  93.   ABN_STATECHANGE    = $0000000;
  94.   ABN_POSCHANGED     = $0000001;
  95.   ABN_FULLSCREENAPP  = $0000002;
  96.   ABN_WINDOWARRANGE  = $0000003; { lParam = True means hide }
  97.  
  98. { flags for get state }
  99.  
  100.   ABS_AUTOHIDE    = $0000001;
  101.   ABS_ALWAYSONTOP = $0000002;
  102.  
  103.   ABE_LEFT        = 0;
  104.   ABE_TOP         = 1;
  105.   ABE_RIGHT       = 2;
  106.   ABE_BOTTOM      = 3;
  107.  
  108. type
  109.   PAppBarData = ^TAppBarData;
  110.   _AppBarData = record
  111.     cbSize: DWORD;
  112.     hWnd: HWND;
  113.     uCallbackMessage: UINT;
  114.     uEdge: UINT;
  115.     rc: TRect;
  116.     lParam: LPARAM; { message specific }
  117.   end;
  118.   {$nonamespace _AppBarData}
  119.   TAppBarData = _AppBarData;
  120.  
  121. function SHAppBarMessage(dwMessage: DWORD; var pData: TAppBarData): UINT; stdcall;
  122.  
  123. function DoEnvironmentSubstA(szString: PAnsiChar; cbString: UINT): DWORD; stdcall;
  124. function DoEnvironmentSubstW(szString: PWideChar; cbString: UINT): DWORD; stdcall;
  125. function DoEnvironmentSubst(szString: PChar; cbString: UINT): DWORD; stdcall;
  126. function FindEnvironmentStringA(szEnvVar: PAnsiChar): PAnsiChar; stdcall;
  127. function FindEnvironmentStringW(szEnvVar: PWideChar): PWideChar; stdcall;
  128. function FindEnvironmentString(szEnvVar: PChar): PChar; stdcall;
  129. function ExtractIconExA(lpszFile: PAnsiChar; nIconIndex: Integer; 
  130.   var phiconLarge, phiconSmall: HICON; nIcons: UINT): UINT; stdcall;
  131. function ExtractIconExW(lpszFile: PWideChar; nIconIndex: Integer; 
  132.   var phiconLarge, phiconSmall: HICON; nIcons: UINT): UINT; stdcall;
  133. function ExtractIconEx(lpszFile: PChar; nIconIndex: Integer; 
  134.   var phiconLarge, phiconSmall: HICON; nIcons: UINT): UINT; stdcall;
  135.  
  136. { Shell File Operations }
  137.  
  138. const
  139.   FO_MOVE           = $0001;
  140.   FO_COPY           = $0002;
  141.   FO_DELETE         = $0003;
  142.   FO_RENAME         = $0004;
  143.  
  144.   FOF_MULTIDESTFILES         = $0001;
  145.   FOF_CONFIRMMOUSE           = $0002;
  146.   FOF_SILENT                 = $0004;  { don't create progress/report }
  147.   FOF_RENAMEONCOLLISION      = $0008;
  148.   FOF_NOCONFIRMATION         = $0010;  { Don't prompt the user. }
  149.   FOF_WANTMAPPINGHANDLE      = $0020;  { Fill in SHFILEOPSTRUCT.hNameMappings
  150.                                          Must be freed using SHFreeNameMappings }
  151.   FOF_ALLOWUNDO              = $0040;
  152.   FOF_FILESONLY              = $0080;  { on *.*, do only files }
  153.   FOF_SIMPLEPROGRESS         = $0100;  { means don't show names of files }
  154.   FOF_NOCONFIRMMKDIR         = $0200;  { don't confirm making any needed dirs }
  155.  
  156. type
  157.   FILEOP_FLAGS = Word;
  158.   {$nonamespace FILEOP_FLAGS}
  159.  
  160. const
  161.   PO_DELETE       = $0013;  { printer is being deleted }
  162.   PO_RENAME       = $0014;  { printer is being renamed }
  163.   PO_PORTCHANGE   = $0020;  { port this printer connected to is being changed
  164.                               if this id is set, the strings received by
  165.                               the copyhook are a doubly-null terminated
  166.                               list of strings.  The first is the printer
  167.                               name and the second is the printer port. }
  168.   PO_REN_PORT     = $0034;  { PO_RENAME and PO_PORTCHANGE at same time. }
  169.  
  170. { no POF_ flags currently defined }
  171.  
  172. type
  173.   PRINTEROP_FLAGS = Word;
  174.   {$nonamespace PRINTEROP_FLAGS}
  175.  
  176. { implicit parameters are:
  177.       if pFrom or pTo are unqualified names the current directories are
  178.       taken from the global current drive/directory settings managed
  179.       by Get/SetCurrentDrive/Directory
  180.  
  181.       the global confirmation settings }
  182.  
  183.   PSHFileOpStructA = ^TSHFileOpStructA;
  184.   PSHFileOpStructW = ^TSHFileOpStructW;
  185.   PSHFileOpStruct = PSHFileOpStructA;
  186.   _SHFILEOPSTRUCTA = packed record
  187.     Wnd: HWND;
  188.     wFunc: UINT;
  189.     pFrom: PAnsiChar;
  190.     pTo: PAnsiChar;
  191.     fFlags: FILEOP_FLAGS;
  192.     fAnyOperationsAborted: BOOL;
  193.     hNameMappings: Pointer;
  194.     lpszProgressTitle: PAnsiChar; { only used if FOF_SIMPLEPROGRESS }
  195.   end;
  196.   {$nonamespace _SHFILEOPSTRUCTA}
  197.   TSHFileOpStructA = _SHFILEOPSTRUCTA;
  198.   _SHFILEOPSTRUCTW = packed record
  199.     Wnd: HWND;
  200.     wFunc: UINT;
  201.     pFrom: PWideChar;
  202.     pTo: PWideChar;
  203.     fFlags: FILEOP_FLAGS;
  204.     fAnyOperationsAborted: BOOL;
  205.     hNameMappings: Pointer;
  206.     lpszProgressTitle: PWideChar; { only used if FOF_SIMPLEPROGRESS }
  207.   end;
  208.   {$nonamespace _SHFILEOPSTRUCTW}
  209.   T